import ddddocr
import os
import cv2
path = os.path.dirname(__file__)
path_ = lambda x:os.path.join(path,'data','shiliang',x)

det = ddddocr.DdddOcr(det=True)

with open(path_('1_0.png'),'rb') as f:
    data = f.read()

res = det.detection(data)
img = cv2.imread(path_('1_0.png'))
for box in res:
    pos1,pos2 = [tuple(box[i:(i+2)]) for i in range(0,len(box),2)]
    img = cv2.rectangle(img,pos1,pos2,color=(0,0,255),thickness=2)
cv2.imshow('det_note',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite(path_('1_1.png'),img)
print(res)



